package net.socket;

import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.Socket;
import java.net.SocketAddress;

public class SocketTest
{
	public static void main(String[] args)
	{
		try
		{
			SocketAddress proxyAddress = new InetSocketAddress("www.baidu.com",80);
			Proxy proxy = new Proxy(Proxy.Type.SOCKS, proxyAddress);
			Socket s = new Socket(proxy);
			SocketAddress remote = new InetSocketAddress("www.qq.com",25);
			System.out.println(s.getInetAddress());
			System.out.println(s.getPort());
			System.out.println(s.getLocalPort());
			System.out.println(s.getLocalAddress());
			
			s.connect(remote);
		}
		catch (Exception e)
		{
			e.printStackTrace();
		}
	}
}
